package isanfeng.tuxiaoer.pattern.creational.Esingleton.lazy;

import isanfeng.tuxiaoer.pattern.creational.Esingleton.ThreadLocalInstance;

/**
 * @author 李红辉
 * @version 1.0
 * @date 2019/10/9 11:41
 */
public class T implements Runnable {
    @Override
    public void run() {
        // 非线程安全的懒汉单例
        // LazySingleton lazySingleton = LazySingleton.getInstance();
        // 线程安全懒汉单例: double check
         LazyDoubleCheckSingleton instance = LazyDoubleCheckSingleton.getInstance();
        // 线程安全懒汉单例: 静态内部类
//        StaticInnerClassSingleton staticInnerClassSingleton = StaticInnerClassSingleton.getInstance();
        // threadlocal单例
//        ThreadLocalInstance instance = ThreadLocalInstance.getInstance();
        System.out.println(Thread.currentThread().getName() + "   " + instance);
    }
}
